<!DOCTYPE html>
<html>

  <head>
    <meta charset="UTF-8">
    <title>总部人员列表</title>
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon"/>
    {CSS href="__ADDONSTATIC__css/font.css" /}
    {CSS href="__ADDONSTATIC__css/xadmin.css" /}
    {js href='__ADDONSTATIC__js/jquery-3.2.1.min.js' /}

    {js href='__ADDONSTATIC__js/xadmin.js' /}
    {js href='__ADDONSTATIC__js/util.js' /}
    {js href='__ADDONSTATIC__lib/layui/layui.js' /}
    <script src="https://cdn.jsdelivr.net/npm/vue"></script>
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
      <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
      <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
  </head>
  
  <body>
    <div class="x-body"  id="page">
      <table class="layui-table">
        <thead>
          <tr>
            <th>用户名</th>
            <th>所属部门</th>
            <th>手机</th>
            <th>操作</th>
        </thead>
        <tbody>
        {volist name='list' id='l'}
        <tr>
          <td>{$l.name}</td>
          <td>{$l.parts.name}</td>
          <td>{$l.phone}</td>
          <td>
            <a title="编辑" onclick="x_admin_show('编辑','{:addonUrl('Member/memberUpdate')}?id={$l.id}')"
               href="javascript:;">
              <i class="layui-icon">&#xe642;</i>
            </a>
            <a title="删除" onclick="member_del({$l.id})" href="javascript:;">
              <i class="layui-icon">&#xe640;</i>
            </a>
          </td>
        </tr>
        {/volist}
        </tbody>
      </table>
    </div>
  </body>
  <script>
      /*用户-删除*/
      function member_del(id){
          layer.confirm('确认要删除吗？',function(index){
              //发异步删除数据
              ajaxUrl('{:addonUrl('Member/deleteMember')}',{id:id},function(data){
                  console.log(data);
                  if(data.code == 1){
                      layer.msg('已删除!',{icon:1,time:1000});
                      app.getListPage();
                  }else{
                      layer.msg(data.message);
                  }
              })
          });
      }
  </script>
</html>